package cn.edu.xmu.oomall.aftersale.model.bo;

import cn.edu.xmu.oomall.aftersale.model.vo.SimpleAdminUserVo;
import cn.edu.xmu.oomall.aftersale.model.vo.SimpleCustomerVo;
import cn.edu.xmu.oomall.aftersale.model.vo.SimpleRegionVo;
import lombok.*;

import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

/**
 * @author X-Raymond
 * @date 2021/12/8
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Aftersale {
    public enum State {
        //新建态
        BEGIN(0,"新建态"),
        //等待买家发货
        WUDELIVER(1,"等待买家发货"),
        //买家已发货
        UDELIVER(2,"买家已发货"),
        //等待退款
        WREFUND(3,"等待退款"),
        //等待卖家发货
        WSDELIVER(4,"等待卖家发货"),
        //卖家已发货
        SDELIVER(5,"卖家已发货"),
        //已结束
        FINISH(6,"已结束"),
        //已取消
        CANCEL(7,"已取消"),
        //待支付
        WPAY(8,"待支付");

        private static final Map<Integer, State> STATE_MAP;
        static { //由类加载机制，静态块初始加载对应的枚举属性到map中，而不用每次取属性时，遍历一次所有枚举值
            STATE_MAP = new HashMap();
            for (State enum1 : values()) {
                STATE_MAP.put(enum1.code, enum1);
            }
        }
        private int code;
        private String description;

        State(int code, String description) {
            this.code = code;
            this.description = description;
        }

        public static State getTypeByCode(Integer code) {
            return STATE_MAP.get(code);
        }

        public Integer getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }
    }

    private Long id;
    private Long orderId;
    private Long orderItemId;
    private Long customerId;
    private Long shopId;
    private Long regionId;
    private String serviceSn;
    private String reason;
    private Byte type;
    private Long price;
    private Long quantity;
    private String detail;
    private String consignee;
    private String mobile;
    private String customerLogSn;
    private String shopLogSn;
    private Byte state;
    private LocalDateTime gmtCreate;
    private LocalDateTime gmtModified;
    private Long creatorId;
    private String creatorName;
    private Long modifierId;
    private String modifierName;
    private String conclusion;
}
